package com.juzhencms.apps.busi.service;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Service;

import com.juzhencms.apps.base.common.database.DBTable;


@Service
public class LinksService extends CommonService{

	
	public List listData(Map param) {
		int menu_id=Integer.parseInt(param.get("menuId")==null?"":param.get("menuId").toString());
		
		List whereParamList=new ArrayList();
		String where=" where menu_id=? and del_flag = 0";
		whereParamList.add(menu_id);
		
		List dataList = this.getJdbcDao().querySql("select * from " + DBTable.links
				+ where, whereParamList.toArray());
		
		if(dataList!=null && dataList.size() > 0){
			for(int i=0;i<dataList.size();i++){
				Map row=(Map)dataList.get(i);
				row.put("link", this.getLink(row));
			}
		}
		
		return dataList;
	}
	
	

	
	public String getLink(Map param) {
		int id= new Integer( param.get("id").toString());
		//return "/linksdetail_" +id ;
		return param.get("link_url").toString();
	}

}
